﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Models;
using BLL;

namespace ShiCaiWang1
{
    public partial class C_SignIn : System.Web.UI.Page
    {
        //private UserInfo user = new UserInfo();
        private UserBLL ub = new UserBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn3_Click(object sender, EventArgs e)
        {
            
            UserInfo user = new UserInfo();
            user.Phone = od1.Text.ToString().Trim();
            user.Email = od1.Text.ToString().Trim();
            user.Account = od1.Text.ToString().Trim();
            user.Pwd = od2.Text.ToString().Trim();
            DataTable dt = ub.GetUserList(user);
            if (dt == null)
            {
                Response.Write("<script>alert('登录失败')</script>");
                return;
            }
            Session["User_HeadPic"] = dt.Rows[0]["User_HeadPic"].ToString();
            Session["UserID"] = dt.Rows[0]["UserID"].ToString();
            Session["Phone"] = dt.Rows[0]["Phone"].ToString();
            Session["Phone"] = dt.Rows[0]["Phone"].ToString();
            Session["Email"] = dt.Rows[0]["Email"].ToString();
            Session["Account"] = dt.Rows[0]["Account"].ToString();
            Session["UserName"] = dt.Rows[0]["UserName"].ToString();
            user.UserID = int.Parse(Session["UserID"].ToString());
            Response.Write("<script>alert('登录成功') ; location.href='C_User.aspx';</script>");
        }
    }
}